package com.bbcare.followup.plat.store.ibatis;

import java.util.List;
import java.util.Map;

import com.bbcare.followup.plat.entity.BsEvaluationStandard;
import com.bbcare.followup.plat.entity.FuAssessMentPosition;
import com.bbcare.followup.plat.entity.PtEvaluationGuide;
import com.bbcare.followup.plat.entity.PtEvaluationResult;

/**
 * 
 * @name:         随访评测服务持久层dao
 * @author:       tao
 * @createTime:   2017年4月24日
 * @description:  IFamilyReportDAO.java
 * @modify:
 *
 */
public interface IFollowEvaluationDAO {
	
	//随访评测记录列表  按用户和类型查询
	List<Map<String, Object>> selectEvaluationResults(Map<String,Object> paramMap) throws Exception;
	//根据记录id查询评估记录
	PtEvaluationResult selectEvaluationResult(Map<String,Object> paramMap) throws Exception;
	//根据userid查询最近一条数据 
	PtEvaluationResult selectEvaluationResultBytime(Map<String,Object> paramMap) throws Exception;
	//随访评测记录总数  按用户和类型查询
	int countEvaluationResults(Map<String,Object> paramMap) throws Exception;
	
	//保存评测记录
	int savePtEvaluationResult(PtEvaluationResult result);

	//随访评测用户列表
	List<Map<String, Object>> selectEvaluationPatientList(Map<String,Object> paramMap) throws Exception;
	//随访评测用户列表总和
	int selectEvaluationPatientCount(Map<String,Object> paramMap) throws Exception;
	
	//卵巢早衰评测用户列表
	List<Map<String, Object>> selectEvaluationPatientListOwn(Map<String,Object> paramMap) throws Exception;
	//卵巢早衰评测用户列表总和
	int selectEvaluationPatientCountOwn(Map<String,Object> paramMap) throws Exception;
	
	//评估问卷 如果redis数据不存在 则查表
	FuAssessMentPosition selectAssessMentPosition(Map<String,Object> paramMap) throws Exception;
	
	//评估问卷 如果redis数据不存在 则查表
	List<FuAssessMentPosition> selectAssessMentPositionBytype(Map<String,Object> paramMap) throws Exception;
	
	//评估问卷保存数据库
	int saveAssessMentPosition(FuAssessMentPosition position) throws Exception;
	
	//查询指导意见
	Map<String,Object> selectEvaluationGuide(Map<String,Object> paramMap) throws Exception;
	
	//查询指导意见 多条记录
	List<Map<String,Object>> selectEvaluationGuides(Map<String,Object> paramMap) throws Exception;
	//添加指导意见
	int savePtEvaluationGuide(PtEvaluationGuide guide)throws Exception;
	
	int saveBatchPtEvaluationGuide(List<PtEvaluationGuide> guides)throws Exception;
	
	//修改指导意见
	int updatePtEvaluationGuide(Map<String,Object> paramMap) throws Exception;
	
	//保存百分位曲线数据
	void saveBsEvaluationStandard(List<BsEvaluationStandard> bsEvaluationStandard) throws Exception;
	//所有aims曲线数据查询
	List<BsEvaluationStandard> selectEvaluationStandardsAll(Map<String,Object> paramMap) throws Exception;
	//根据年龄查询百分位数据
	BsEvaluationStandard selectEvaluationStandardsByAge(Map<String,Object> paramMap) throws Exception;
	//查询得分记录详情
	Map<String,Object> selectEvaluationResultDetail(Map<String,Object> paramMap) throws Exception;
	
	//查询系统默认配置指导意见
	List<Map<String,Object>> selectDefaultGuides(Map<String,Object> paramMap) throws Exception;
	
	//查询队列或租户下  所有用户评测记录
	List<Map<String, Object>> selectEvaluationResultAll(Map<String,Object> paramMap) throws Exception;
	
	//查询得分记录详情
	List<Map<String, Object>> selectEvaluationResultDate(Map<String,Object> paramMap) throws Exception;
	//查询gms指导意见
	List<Map<String, Object>> selectEvaluationGmsGuide(Map<String, Object> param)throws Exception;
	
	//根据用户id查询评估信息
	List<Map<String, Object>> selectEvaluationResultGroup(Map<String,Object> paramMap) throws Exception;
	
	//根据用户id查询用户同一天的评估信息
	List<Map<String, Object>> selectEvaluationResultGroupType(Map<String,Object> paramMap) throws Exception;
	
	//查询mabc各个评估的填写情况
	List<Map<String, Object>> selectMabcEvaluationRecord(Map<String,Object> paramMap) throws Exception;
	
	//查询评估每天最新一条记录
	List<Map<String, Object>> selectEvaluationGroupByDate(Map<String,Object> paramMap) throws Exception;

	// 通过用户id查询用户年龄 查询表 pt_user_info
	public List<Map<String, Object>> selectbirthdayByuserId(String userId) throws Exception;

	//mabc用户列表总和
	int selectMabcCount(Map<String,Object> paramMap) throws Exception;

	//mabc用户列表
	List<Map<String, Object>> selectMabcList(Map<String,Object> paramMap) throws Exception;

	// 通过用户id查询用户评估问卷列表
	public List<Map<String, Object>> selectAppList(Map<String,Object> map) throws Exception;

	/**
	 * 删除评估历史记录（物理删除）。
	 * @param evaluationId
	 * @return
	 * @throws Exception
	 */
	int deleteEvaluationResult(final String evaluationId) throws Exception;
	int deleteEvaluationGuide(final String evaluationId) throws Exception;

	//保存peabody量表评测的草稿。
	int saveDraftForPeabody(final PtEvaluationResult result);
	List<PtEvaluationResult> selectDraftForPeabody(final Map<String,Object> paraMap);
	int deleteDraftForPeabody(final String userId) throws Exception;
}
